/**
* @Description: WoShop商城
* @Author: 梧桐
* @Copyright: 武汉一一零七科技有限公司©版权所有
* @Link: www.s1107.com
* @Contact: QQ:2487937004
*/
<template>
  <view class="page">
    <view class="headTop">
      <div class="headBg" v-if="false"></div>
      <div class="top u-flex u-p-30" >
        <u-avatar :src="info.src" class="u-m-r-20" size="large"></u-avatar>
        <div class="right">
          <h4>{{'手机号'+info.phone}}</h4>
          <p class="u-font-xs">{{'我的等级:' + info.grade_name}}</p>
          <p class="u-font-xs">{{'推荐人:' + info.user_parent}}</p>
        </div>
      </div>
      <view class="countCard u-m-r-30 u-m-l-30 u-rela ">
        
        <view class="u-p-35">
          <u-tag text="去提现" shape="circle" type="warning" class="withDrawBtn" @click="getBankCardinfo" />
          <view>
            <view class="u-font-sm">可提现佣金：</view>
            <view class="u-font-xl u-font-bold u-m-t-15 canwithdrawal">{{ info.withdrawal | defaultValue }}</view>
          </view>
          <view class="u-flex u-row-between u-m-t-50 ">
            <view >
              <view class="u-font-sm">累计分销佣金:</view>
              <view class="num u-font-lg u-m-t-15">{{ info.commission | defaultValue}}</view>
            </view>
            <view >
              <view class="u-font-sm">已提现：</view>
              <view class="num u-font-lg u-m-t-15">{{info.withdrawal_success | defaultValue}}</view>
            </view>
          
          </view>
        </view>
      
      
      </view>
    
    </view>
    
    <view class="recommendWrap  u-flex u-flex-wrap u-p-t-20 u-m-t-20">
      
      <view @click="order('/pagesB/distribution/commissionDetail')" class="u-flex u-flex-1 u-flex-col u-col-center">
        <u-icon name="red-packet" color="#444" size="58"></u-icon>
        <text class="u-m-t-15">分销佣金</text>
        <text>{{info.commission}}</text>
      </view>
      <view @click="order('/pagesB/distribution/commissionList')" class="u-flex u-flex-1  u-flex-col u-col-center">
        <u-icon name="order" color="#444" size="58"></u-icon>
        <text class="u-m-t-15">佣金明细</text>
        <text>{{info.commisson_num}}</text>
      </view>
      <view @click="order('/pagesB/distribution/withdrawList')" class="u-flex u-flex-1  u-flex-col u-col-center">
        <u-icon name="file-text" color="#444" size="58"></u-icon>
        <text class="u-m-t-15">提现明细</text>
        <text>{{info.withdrawal_num}}</text>
      </view>
      <view @click="getnav('/pagesB/distribution/myTeam')" class="u-flex u-flex-col u-flex-1  u-col-center">
        <u-icon name="account" color="#444" size="58"></u-icon>
        <text class="u-m-t-15">我的团队</text>
        <text >{{info.total_user}}</text>
      </view>
    </view>
  
  
  
  </view>
</template>

<script>
export default {
  data() {
    return {
      isLogin: true,
      usedNum: 0.00,
      recommenMan: '',
      recommenList: '',
      info: {},
      pageShow: false,
      money: '',
    }
  },
  
  onLoad() {
    this.getInfo()
  },
  methods: {
    
    navigateTo(url, type) {
      // type是否需要登陆条件
      if (type) {
        if (this.isLogin) {
          this.$navigateTo(url)
        } else {
          this.$navigateTo('/pagesB/login/login')
        }
      } else {
        this.$navigateTo(url)
      }
      
    },
    back() {
      this.getback()
    },
    getInfo() {
      this.$loading()
      this.$http.getDistributionInfo().then(res => {
        if (res.status === 200) {
          this.info = res.data.user
          
        }
      })
    },
    getWallet() {
      this.$http.getWallet().then(res => {
        if (res.status == 200) {
          this.money = res.data.price
        }
      })
    },
    getBankCardinfo() {
      this.$http.getBankCardinfo().then(res => {
        if (res.status == 200) {
          if (res.data) {
            this.getnav('/pagesB/wallet/withdraw')
          } else {
            this.$toast('请先绑定银行卡')
            setTimeout(() => {
              this.getnav('/pagesB/moneyCartSon/Mybankcard')
            }, 1000)
          }
          
        }
      })
    },
    navigateToArticle(url) {
      
      uni.navigateTo({
        url: '/pagesB/article/detail?title=' + '' + url,
      })
      
    },
    //跳转到不同的分类状态
    order(url, data) {
      if (this.isLogin) {
        this.$navigateTo(url, data)
      } else {
        this.$navigateTo('/pagesB/login/login')
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import "uview-ui/index.scss";
.head{
  background-color: #333;
  color: #fff;
}

.imgWrap{
  width: 25%;
}
.countCard{
  border-radius: 16upx;
  color: #fff;
  background-color: #333;
  .canwithdrawal{
    font-size: 54upx;
    font-width: 600;
  }
}
.headTop{
  background-color: #fff;
}
.headBg {
  widht: 100%;
  position: absolute;
  height: 170upx;
  /*  #ifdef  H5 */
  height: 80upx;
  /*  #endif  */
  background: #333;
  position: relative;
  
  &::after {
    $height: 190upx;
    content: '';
    position: absolute;
    width: 100%;
    height: $height;
    background: inherit;
    display: block;
    bottom: -$height;
    border-radius: 0 0 60% 60%;
    box-shadow: 0 20upx 0 16upx #ffa6a6, 0 28upx 0 26upx #ffdddd;
  }
}
.withDrawBtn{
  position: absolute;
  top: 40upx;
  right: 30upx;
}
.recommendWrap{
  background-color: #fff;
  padding: 16upx;
}
</style>
